#pragma once

namespace ManagedVC1
{
	public ref class CommonFrameRate sealed
	{
	private:
        System::String^ m_name;
		double m_rate, m_num, m_den;

	public:
        CommonFrameRate(System::String^ name, double rate, double numerator, double denominator)
		{
            m_name = name;
			m_rate = rate;
			m_num = numerator;
			m_den = denominator;
		}

		property double Rate
		{
			double get() { return m_rate; }
		}

		property double Numerator
		{
			double get() { return m_num; }
		}

		property double Denominator
		{
			double get() { return m_den; }
		}

        virtual System::String^ ToString() override
        {
            return System::String::Format("{0} ({1:F2})", m_name, m_rate);
        }
	};

	public ref class FrameRates
	{
	public:
		static CommonFrameRate^ NTSCp = gcnew CommonFrameRate("NTSCp", 29.97, 30000, 1001);
		static CommonFrameRate^ PALp = gcnew CommonFrameRate("PALp", 25.0, 25, 1);
		static CommonFrameRate^ Cinema = gcnew CommonFrameRate("Cinema", 24.0, 24, 1);
		static CommonFrameRate^ Telecine = gcnew CommonFrameRate("Telecine", 23.976, 24000, 1001);
		static CommonFrameRate^ NTSCi = gcnew CommonFrameRate("NTSCi", 59.94, 60000, 1001);
		static CommonFrameRate^ PALi = gcnew CommonFrameRate("PALi", 50.0, 50, 1);

		static System::Collections::Generic::List<CommonFrameRate^>^ All;
		
		static FrameRates() {
			All = gcnew System::Collections::Generic::List<CommonFrameRate^>();
			All->Add(NTSCp);
			All->Add(PALp);
			All->Add(Cinema);
			All->Add(Telecine);
			All->Add(NTSCi);
			All->Add(PALi);
		};
	};
}